package com.threeman.mapswaypoints1;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

public class menuMapsActivity extends Activity {

	private Button mButtonMaps;
	private Button mButtonSatellite;

	private Context mContext;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //View
        setContentView(R.layout.maps);
        mContext = getApplicationContext();
        
        mButtonSatellite = (Button)findViewById(R.id.buttonSatellite);
        mButtonMaps = (Button)findViewById(R.id.buttonMaps);
        
		try
		{
	        //get params
	        Bundle bun = this.getIntent().getExtras();
	        boolean isSatellite = bun.getBoolean("isSatellite");
	        
	        if(isSatellite)
	        	mButtonSatellite.setBackgroundColor(Color.GREEN);
	        else
	        	mButtonMaps.setBackgroundColor(Color.GREEN);
	        
		}
		catch(Exception ex)
		{
			showToastMessage(ex.toString());
		}       
		
    }
	
    @Override
	protected void onPause() {
		// TODO Auto-generated method stub
    	super.onPause();
	}
    
    
    public void mapsClick(View v) 
    {
		try
		{
			showToastMessage("TRYB: MAPY");
			
	    	Bundle bundle = new Bundle();

	    	bundle.putInt("mapMode", 1);
	    	
	    	Intent i = new Intent();

	    	i.putExtras(bundle);

	    	setResult(10, i);
	    	
	    	finish();
		}
		catch(Exception ex)
		{
			showToastMessage(ex.toString());
		}
    }
    
    public void satelliteClick(View v) 
    {
		try
		{
			showToastMessage("TRYB: SATELITA");
			
	    	Bundle bundle = new Bundle();

	    	bundle.putInt("mapMode", 2);
	    	
	    	Intent i = new Intent();

	    	i.putExtras(bundle);

	    	setResult(10, i);
	    	
	    	finish();
		}
		catch(Exception ex)
		{
			showToastMessage(ex.toString());
		}
    }
    
    public void hybridClick(View v) 
    {
		try
		{
			showToastMessage("TRYB: HYBRYDA");
			
	    	Bundle bundle = new Bundle();

	    	bundle.putInt("mapMode", 3);
	    	
	    	Intent i = new Intent();

	    	i.putExtras(bundle);

	    	setResult(10, i);
	    	
	    	finish();
		}
		catch(Exception ex)
		{
			showToastMessage(ex.toString());
		}
    }
    
    /*
     * OTHER METHODS
     */
	private void showToastMessage(String msg)
	{

	      Toast toast = Toast.makeText(this, msg, Toast.LENGTH_SHORT);

	      toast.show();

	}
}
